from hashtable import HashTable

class Student:
    def __init__(self, id, name, age):
        self.id = id
        self.name = name
        self.age = age

    def __hash__(self):
        # 使用对象的id属性作为哈希值的基础
        return hash(self.id)

    def __eq__(self, other):
        # 比较两个Student对象是否相等
        if isinstance(other, Student):
            return self.id == other.id
        return False

# # 示例使用
# hash_table = HashTable()
# student1 = Student(1, 'Alice', 20)
# student2 = Student(2, 'Bob', 22)

# hash_table.insert(student1, 'First student')
# hash_table.insert(student2, 'Second student')

# print(hash_table.get(student1))  # 输出: First student
# print(hash_table.get(student2))  # 输出: Second student